Skip to contentSkip to conversation

No dbus objects for phosphor-regulators

DISCUSSION Mike 4 participants 9 messages Jan 31, 2022 – Feb 11, 2022

lore
Share & tools
lore

Mike

author
#0 lore raw

Jason,

Sent from my iPhone

Quoted 7 lines · Shawn McCarney


Hi Mike,

Quoted 1 line

I made a config file below, and verified that it is on the target and loads without error.

Just to make sure I understand what you are saying, on the BMC your 'config.json' file is installed in the /usr/share/phosphor-regulators directory

Correct

Quoted 2 lines

And when you run 'journalctl -u phosphor-regulators.service', you see a journal message stating that the phosphor-regulators application has loaded your JSON file successfully? And no error messages?

Correct

Quoted 3 lines
Quoted 1 line

When the target boots, using a I2C spy tool, the 0xDD command is being read periodically, suggesting that this service is processing the read command, and a query show the service is up.

Sensor reading should begin when the chassis is powered on and stop when the chassis is powered off. That is because some regulators don't have power at standby or report invalid sensor readings.

I am using the SDK, so I have not worked on chassis power, so I don’t know if it is powered or not, but this gives me a good hint about the problem. Even so, the read command in config.json is getting polled. The other config item to modify the voltage did not occur.

Given I am using an Aspeed EVK, is there an example for how to turn on a chassis with a GPIO, or a dbus operation, or an automatic turn on at boot?

Quoted 2 lines

Does the 'journalctl | grep -i Regulators' show that the service files are being executed that enable and disable regulator sensor monitoring?

No, only the daemon starting.

Quoted 9 lines
Quoted 1 line

Using dbus-monitor –system, I do not see any transactions that place these sensor read values on dbus, nor does the normal probing the chassis and inventory show values.

Since you are reading a vout sensor for the rail named "vdd", the resulting D-Bus object path for the sensor should be

/xyz/openbmc_project/sensors/voltage/vdd_vout

See https://github.com/openbmc/phosphor-power/blob/master/phosphor-regulators/docs/config_file/pmbus_read_sensor.md#d-bus-sensor for more details.

Does that object path exist on D-Bus after you've powered on the chassis and sensor monitoring has been enabled?

It does not exist.

Quoted 8 lines

You can see all the properties of the D-Bus sensor using the command

busctl introspect xyz.openbmc_project.Power.Regulators /xyz/openbmc_project/sensors/voltage/vdd_vout

You can see all regulator sensor object paths via the command:

busctl tree xyz.openbmc_project.Power.Regulators

Quoted 9 lines

The phosphor-regulators application reads sensors once per second. However, it only updates D-Bus if the new sensor value has changed more than a hysteresis amount. This is to avoid generating a bunch of D-Bus traffic for minor value changes.

You can see the hysteresis values here: https://github.com/openbmc/phosphor-power/blob/master/phosphor-regulators/src/dbus_sensor.cpp#L66

Quoted 1 line

What else do I need to so that there are dbus objects?

For bmcweb and Redfish to work, you need associations between the D-Bus sensor and two D-Bus inventory objects:

* The FRU that contains the regulator. This is the replaceable hardware item where the regulator is located. Some regulators are FRUs by themselves (replaceable). Some are located on larger FRUs like a motherboard. This is used to get presence, health info, and if applicable VPD.

Ah, it did not occurs to me that a mother board as FRU is wapping regulators inside an FRU. Seems obvious now.

Quoted 2 lines

* The chassis that contains the regulator. This is required by Redfish since it groups sensors by chassis.

Ok

Quoted 4 lines

The phosphor-regulators application creates those associations automatically based on information in your JSON file. The "fru" property of the regulator "device" provides the first inventory object path. The "inventory_path" property of the "chassis" provides the second inventory path. Both of those are relative to the "/xyz/openbmc_project/inventory" root path.

Do the "fru" and "inventory_path" properties in your JSON file match the correct inventory object paths on your system?

I have a psu.json with fruConfigs, and this has

“PsuDevices”: {
“/xyz/openbmc-project/inventory/system/chassis/motherboard/powersupply0” : “/sys/bus/i2c/devices/11-004f”,
}

Which is the same i2c address as used by phosphor-regulators.

And a power-supply-monitor-0.conf to match.

Quoted 7 lines
Quoted 1 line

Note I have not done anything to intentionally use open_power. My goal is to only use phosphor-regulators to expose some telemetry that hwmon does not support.

That's fine. This application does not have any dependencies on open_power.

Let me know if you need more info.

Shawn

Mike

#1 lore raw
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

When the target boots, using a I2C spy tool, the 0xDD command is being read periodically, suggesting that this service is processing the read command, and a query show the service is up.

Sensor reading should begin when the chassis is powered on and stop when the chassis is powered off.  That is because some regulators don't have power at standby or report invalid sensor readings.

I am using the SDK, so I have not worked on chassis power, so I don’t know if it is powered or not, but this gives me a good hint about the problem. Even so, the read command in config.json is getting polled. The other config item to modify the voltage did not occur.

It sounds like at least part of the problem might be the systemd service files not running.  The regulators service files are located in https://github.com/openbmc/phosphor-power/tree/master/services.

* phosphor-regulators.service:  This one launches the regulators app.  This must be happening since you are a getting journal message about it loading the JSON config file.

* phosphor-regulators-config.service:  This is what causes the configuration entries to be executed in the JSON file.  This should happen early in the process of powering on the chassis before the regulators have received power (been enabled).

* phosphor-regulators-monitor-enable.service:  This enables sensor and phase fault monitoring.  This should happen during the chassis power on after the regulators have received power (been enabled).

* phosphor-regulators-monitor-disable.service:  This disables sensor and phase fault monitoring.  This should happen early when the chassis is being powered off.

Sounds like maybe the last 3 service files are being run?  You can tell for sure by looking in the journal (e.g. 'journalctl | grep -i regulator').  The Wants/Before/After dependencies in the files determine when they are run.  Perhaps the systemd targets they are dependent on aren't running on your system?

You can manually cause the regulators application to perform configuration and sensor monitoring using the 'regsctl' program. Look at the service files to see the proper regsctl command to use.  This is an implementation detail and could change in the future, but it may help with debugging right now.

Regarding the fact the 0xDD is being read, is it possibly being read by another application like hwmon?

Note that the phosphor-regulators application does direct I2C reads and writes using the i2c-dev subsystem.  This is the same code path as i2cget/i2cset.  This means it should not be used in conjunction with a device driver on the regulator.  Otherwise there may be interleaved I2C commands going to the device, which can be problematic.

Quoted 3 lines

Given I am using an Aspeed EVK, is there an example for how to turn on a chassis with a GPIO, or a dbus operation, or an automatic turn on at boot?

Sorry, I'm not very familiar with that.  Others on this list could help more with that as a separate question thread.  I use the 'obmcutil chassison' command.  Since that is a script, you could check out what it is doing and see if that would help.

Quoted 7 lines
Quoted 5 lines

The phosphor-regulators application creates those associations automatically based on information in your JSON file.  The "fru" property of the regulator "device" provides the first inventory object path.  The "inventory_path" property of the "chassis" provides the second inventory path.  Both of those are relative to the "/xyz/openbmc_project/inventory" root path.

Do the "fru" and "inventory_path" properties in your JSON file match the correct inventory object paths on your system?

I have a psu.json with fruConfigs, and this has

Quoted 8 lines

“PsuDevices”: {
“/xyz/openbmc-project/inventory/system/chassis/motherboard/powersupply0” : “/sys/bus/i2c/devices/11-004f”, }

Which is the same i2c address as used by phosphor-regulators.

And a power-supply-monitor-0.conf to match.

It sounds like you are using a power supply application from the same repository.  That is no problem, but they are completely separate applications that do no share any data/functionality.  So I don't think the work you've done with the PSU app would impact the regulators app.

It may be a typo above, but a voltage regulator would not normally be at the same I2C address as a power supply.  The term 'power supply' in that repo means the device that converts AC/DC wall power to 12V DC to the system (e.g. the big brick).  The term 'voltage regulator' means the devices that step 12V DC from the power supply down to the levels needed by system components (like 3.3V, 1.1V, etc.).

author
#2 lore raw

The journal shows an I2C error: Device or resource busy.

Does hwmon lock out phosphor-regulators if it uses the same address?

Sent from my iPad

Quoted 49 lines · Shawn McCarney



Quoted 5 lines
Quoted 3 lines
Quoted 1 line

When the target boots, using a I2C spy tool, the 0xDD command is being read periodically, suggesting that this service is processing the read command, and a query show the service is up.

Sensor reading should begin when the chassis is powered on and stop when the chassis is powered off. That is because some regulators don't have power at standby or report invalid sensor readings.

I am using the SDK, so I have not worked on chassis power, so I don’t know if it is powered or not, but this gives me a good hint about the problem. Even so, the read command in config.json is getting polled. The other config item to modify the voltage did not occur.

It sounds like at least part of the problem might be the systemd service files not running. The regulators service files are located in https://github.com/openbmc/phosphor-power/tree/master/services.

* phosphor-regulators.service: This one launches the regulators app. This must be happening since you are a getting journal message about it loading the JSON config file.

* phosphor-regulators-config.service: This is what causes the configuration entries to be executed in the JSON file. This should happen early in the process of powering on the chassis before the regulators have received power (been enabled).

* phosphor-regulators-monitor-enable.service: This enables sensor and phase fault monitoring. This should happen during the chassis power on after the regulators have received power (been enabled).

* phosphor-regulators-monitor-disable.service: This disables sensor and phase fault monitoring. This should happen early when the chassis is being powered off.

Sounds like maybe the last 3 service files are being run? You can tell for sure by looking in the journal (e.g. 'journalctl | grep -i regulator'). The Wants/Before/After dependencies in the files determine when they are run. Perhaps the systemd targets they are dependent on aren't running on your system?

You can manually cause the regulators application to perform configuration and sensor monitoring using the 'regsctl' program. Look at the service files to see the proper regsctl command to use. This is an implementation detail and could change in the future, but it may help with debugging right now.

Regarding the fact the 0xDD is being read, is it possibly being read by another application like hwmon?

Note that the phosphor-regulators application does direct I2C reads and writes using the i2c-dev subsystem. This is the same code path as i2cget/i2cset. This means it should not be used in conjunction with a device driver on the regulator. Otherwise there may be interleaved I2C commands going to the device, which can be problematic.

Quoted 3 lines

Given I am using an Aspeed EVK, is there an example for how to turn on a chassis with a GPIO, or a dbus operation, or an automatic turn on at boot?

Sorry, I'm not very familiar with that. Others on this list could help more with that as a separate question thread. I use the 'obmcutil chassison' command. Since that is a script, you could check out what it is doing and see if that would help.

Quoted 7 lines
Quoted 5 lines

The phosphor-regulators application creates those associations automatically based on information in your JSON file. The "fru" property of the regulator "device" provides the first inventory object path. The "inventory_path" property of the "chassis" provides the second inventory path. Both of those are relative to the "/xyz/openbmc_project/inventory" root path.

Do the "fru" and "inventory_path" properties in your JSON file match the correct inventory object paths on your system?

I have a psu.json with fruConfigs, and this has

Quoted 8 lines

“PsuDevices”: {
“/xyz/openbmc-project/inventory/system/chassis/motherboard/powersupply0” : “/sys/bus/i2c/devices/11-004f”,
}

Which is the same i2c address as used by phosphor-regulators.

And a power-supply-monitor-0.conf to match.

It sounds like you are using a power supply application from the same repository. That is no problem, but they are completely separate applications that do no share any data/functionality. So I don't think the work you've done with the PSU app would impact the regulators app.

It may be a typo above, but a voltage regulator would not normally be at the same I2C address as a power supply. The term 'power supply' in that repo means the device that converts AC/DC wall power to 12V DC to the system (e.g. the big brick). The term 'voltage regulator' means the devices that step 12V DC from the power supply down to the levels needed by system components (like 3.3V, 1.1V, etc.).

#3 lore raw
Quoted 6 lines · Mike Jones

The journal shows an I2C error: Device or resource busy. Does hwmon lock out phosphor-regulators if it uses the same address? Sent from my iPad On Feb 1, 2022, at 10:38 AM, Shawn McCarney <[email protected]> wrote:  ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍

The journal shows an I2C error: Device or resource busy.

Does hwmon lock out phosphor-regulators if it uses the same address?

phosphor-regulators currently communicates directly with voltage regulators using i2c-dev; it does not use device drivers.

The reason is that most regulator drivers provide either no or very limited ability to configure regulators.  For the systems I work on, we need to do extensive regulator configuration to fine tune things (output voltage, pgood min/max, timing, etc.) Redundant phase fault detection is also pretty device-specific and on involves communicating with multiple devices.

I have not tested using phosphor-regulators when a driver is bound to the regulator, but I suspect you may be right.  I assume hwmon is using read sensor data from a driver, and the driver being bound is stopping the phosphor-regulators read from succeeding.

Thanks,

Shawn

author
#4 lore raw

Shawn,

I was mainly surprised because a conversation I had with Guenter, if I remember correctly, suggested that /dev/i2c calls from user space work with hwmon, because hwmon does not lock the i2c except when using it.

So I assumed that in this case, it was the polling of hwmon that was just keeping it locked enough to conflict with phosphor-regulators and then it gives up.

I could just not use hwmon at all use phosphor-regulators for all telemetry, but this seemed like more work.

Also, I will need to figure out how to connect phosphor-regulators telemetry to Redfish and the WebUI. Are there examples of how to do that?

Mike

Quoted 17 lines · Shawn McCarney
Quoted 4 lines · Mike Jones

The journal shows an I2C error: Device or resource busy.

Does hwmon lock out phosphor-regulators if it uses the same address?

phosphor-regulators currently communicates directly with voltage regulators using i2c-dev; it does not use device drivers.

The reason is that most regulator drivers provide either no or very limited ability to configure regulators. For the systems I work on, we need to do extensive regulator configuration to fine tune things (output voltage, pgood min/max, timing, etc.) Redundant phase fault detection is also pretty device-specific and on involves communicating with multiple devices.

I have not tested using phosphor-regulators when a driver is bound to the regulator, but I suspect you may be right. I assume hwmon is using read sensor data from a driver, and the driver being bound is stopping the phosphor-regulators read from succeeding.

Thanks,

Shawn

#5 lore raw
Quoted 3 lines · Mike Jones

Shawn, I was mainly surprised because a conversation I had with Guenter, if I remember correctly, suggested that /dev/i2c calls from user space work with hwmon, because hwmon does not lock the i2c except when using it. So I assumed that in this I was mainly surprised because a conversation I had with Guenter, if I remember correctly, suggested that /dev/i2c calls from user space work with hwmon, because hwmon does not lock the i2c except when using it.

So I assumed that in this case, it was the polling of hwmon that was just keeping it locked enough to conflict with phosphor-regulators and then it gives up.

With i2c-dev, you can specify I2C_SLAVE or I2C_SLAVE_FORCE when creating the connection.  I believe I2C_SLAVE will cause communication attempts to fail if a driver is bound. I2C_SLAVE_FORCE will still try to communicate.

I wanted to take the more conservative approach, because there are scenarios where interleaving communication can cause serious problems.  For example, if one PMBus regulator supports multiple rails, you have to set the PMBus PAGE register to the rail you are interested in.  Subsequent PMBus commands will affect that rail. If phosphor-regulators and a driver are both communicating with the regulator, they may both be setting PAGE and thus their subsequent commands are going to the wrong rail.

Quoted 3 lines

I could just not use hwmon at all use phosphor-regulators for all telemetry, but this seemed like more work.

Sorry about that.  I think if you have already done the work of defining the regulator and a read sensors rule in your JSON file, adding a few more sensors is not much additional work though.  Let me know if you have questions.

Quoted 1 line

Also, I will need to figure out how to connect phosphor-regulators telemetry to Redfish and the WebUI. Are there examples of how to do that?

It should just work with no additional effort as long as you define the following correctly in your JSON file:

* The "inventory_path" property of your "chassis" object needs to match a real chassis inventory item on D-Bus.

* The "fru" property of your regulator "device" object needs to match a real inventory item on D-Bus.  As I mentioned earlier, normally if the regulator is pluggable then this is the regulator itself.  Otherwise it is the larger hardware item that contains it, such as a motherboard.  FRU is the acronym for Field Replaceable Unit, referring to a pluggable hardware item.

phosphor-regulators will publish your sensors on D-Bus with the standard object paths and properties.  The two JSON properties above are used to define a "chassis" association and an "inventory_item" association on D-Bus that is used by bmcweb. This will cause your sensors to appear in Redfish and the Web UI.

Thanks,

Shawn

#6 lore raw
Quoted 22 lines · Shawn McCarney

On 2/11/2022 9:42 AM, Mike Jones wrote:

I was mainly surprised because a conversation I had with Guenter, if I remember correctly, suggested that /dev/i2c calls from user space work with hwmon, because hwmon does not lock the i2c except when using it.

So I assumed that in this case, it was the polling of hwmon that was just keeping it locked enough to conflict with phosphor-regulators and then it gives up.

With i2c-dev, you can specify I2C_SLAVE or I2C_SLAVE_FORCE when creating the connection. I believe I2C_SLAVE will cause communication attempts to fail if a driver is bound. I2C_SLAVE_FORCE will still try to communicate.

I wanted to take the more conservative approach, because there are scenarios where interleaving communication can cause serious problems. For example, if one PMBus regulator supports multiple rails, you have to set the PMBus PAGE register to the rail you are interested in. Subsequent PMBus commands will affect that rail. If phosphor-regulators and a driver are both communicating with the regulator, they may both be setting PAGE and thus their subsequent commands are going to the wrong rail.

I could just not use hwmon at all use phosphor-regulators for all telemetry, but this seemed like more work.

Sorry about that. I think if you have already done the work of defining the regulator and a read sensors rule in your JSON file, adding a few more sensors is not much additional work though. Let me know if you have questions.

Also, I will need to figure out how to connect phosphor-regulators telemetry to Redfish and the WebUI. Are there examples of how to do that?

It should just work with no additional effort as long as you define the following correctly in your JSON file:

* The "inventory_path" property of your "chassis" object needs to match a real chassis inventory item on D-Bus.

Quoted 7 lines

* The "fru" property of your regulator "device" object needs to match a real inventory item on D-Bus. As I mentioned earlier, normally if the regulator is pluggable then this is the regulator itself. Otherwise it is the larger hardware item that contains it, such as a motherboard. FRU is the acronym for Field Replaceable Unit, referring to a pluggable hardware item.

phosphor-regulators will publish your sensors on D-Bus with the standard object paths and properties. The two JSON properties above are used to define a "chassis" association and an "inventory_item" association on D-Bus that is used by bmcweb. This will cause your sensors to appear in Redfish and the Web UI.

Thanks,

Shawn

This same topic is essentially being discussed in a design doc here:
https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/50509

I've CCed the relevant parties from that review on this thread, and I don't have a strong opinion what forum we use to discuss this, but we should ideally all be talking together on a common solution.

author
#7 lore raw

Sent from my iPad

Quoted 27 lines · Ed Tanous
Quoted 24 lines · Shawn McCarney

On 2/11/2022 9:42 AM, Mike Jones wrote:

I was mainly surprised because a conversation I had with Guenter, if I remember correctly, suggested that /dev/i2c calls from user space work with hwmon, because hwmon does not lock the i2c except when using it.

So I assumed that in this case, it was the polling of hwmon that was just keeping it locked enough to conflict with phosphor-regulators and then it gives up.

With i2c-dev, you can specify I2C_SLAVE or I2C_SLAVE_FORCE when creating the connection. I believe I2C_SLAVE will cause communication attempts to fail if a driver is bound. I2C_SLAVE_FORCE will still try to communicate.

I wanted to take the more conservative approach, because there are scenarios where interleaving communication can cause serious problems. For example, if one PMBus regulator supports multiple rails, you have to set the PMBus PAGE register to the rail you are interested in. Subsequent PMBus commands will affect that rail. If phosphor-regulators and a driver are both communicating with the regulator, they may both be setting PAGE and thus their subsequent commands are going to the wrong rail.

I could just not use hwmon at all use phosphor-regulators for all telemetry, but this seemed like more work.

Sorry about that. I think if you have already done the work of defining the regulator and a read sensors rule in your JSON file, adding a few more sensors is not much additional work though. Let me know if you have questions.

Also, I will need to figure out how to connect phosphor-regulators telemetry to Redfish and the WebUI. Are there examples of how to do that?

It should just work with no additional effort as long as you define the following correctly in your JSON file:

* The "inventory_path" property of your "chassis" object needs to match a real chassis inventory item on D-Bus.

* The "fru" property of your regulator "device" object needs to match a real inventory item on D-Bus. As I mentioned earlier, normally if the regulator is pluggable then this is the regulator itself. Otherwise it is the larger hardware item that contains it, such as a motherboard. FRU is the acronym for Field Replaceable Unit, referring to a pluggable hardware item.

Quoted 8 lines
Quoted 5 lines

phosphor-regulators will publish your sensors on D-Bus with the standard object paths and properties. The two JSON properties above are used to define a "chassis" association and an "inventory_item" association on D-Bus that is used by bmcweb. This will cause your sensors to appear in Redfish and the Web UI.

Thanks,

Shawn

This same topic is essentially being discussed in a design doc here:
https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/50509

I will move my discussion to Gerrit.

Note that I work for ADI, my team supports ADM1266, ADM1278, LTC297X, LTC388X, the MAX devices in this category, and I am on the SMIF (PMBus) Board and on the PMBus Technical Committee.

Quoted 4 lines

I've CCed the relevant parties from that review on this thread, and I don't have a strong opinion what forum we use to discuss this, but we should ideally all be talking together on a common solution.

#8 lore raw
In reply to Shawn McCarney
Quoted 6 lines · Shawn McCarney
Quoted 2 lines · Mike Jones

iPad On Feb 1, 2022, at 10:38 AM, Shawn McCarney <[email protected]> wrote:  ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍

phosphor-regulators currently communicates directly with voltage regulators using i2c-dev; it does not use device drivers.

Quoted 6 lines

The reason is that most regulator drivers provide either no or very limited ability to configure regulators.  For the systems I work on, we need to do extensive regulator configuration to fine tune things (output voltage, pgood min/max, timing, etc.) Redundant phase fault detection is also pretty device-specific and on involves communicating with multiple devices.

Out of curiosity, had you done any investigation with getting the support you need upstreamed in drivers? If you had upstream discussions I'd like some pointers to them (lore links) since, as Ed pointed out, we're having design discussions on this same problem generally speaking.

Signature · 1 line
Patrick Williams